package com.wn.service;

import com.alibaba.csp.sentinel.annotation.SentinelResource;
import org.springframework.stereotype.Service;

@Service
public class MyServiceImpl {

    // 将此方法标注为sentinel的资源。
    // value=资源名
    // fallback= 降级的方法
    @SentinelResource(value = "some",fallback = "exceptionHandler")
    public String doSomething(){
        System.out.println("doSomething...");
        return "doSomething";
    }

    public String exceptionHandler(){
        System.out.println("doSomething: 发生流控");
        return "MyServiceImpl doSomething 发生流控";
    }
}